import React, { ComponentType, PropsWithChildren } from 'react'
import { Navigate } from 'react-router-dom'

interface Props {

}

const Gao = (Com: ComponentType<object>) => {
    return (props: PropsWithChildren<object>) => {
        let token = localStorage.getItem('token') || ''
        if (token) {
            return <Com {...props}></Com>
        }
        else {
            return <Navigate to='/login'></Navigate>
        }
    }
}

export default Gao
